package com.woniuxy.microretailserver.controller;

import com.woniuxy.microretailserver.bean.SummaryCountDateBean;
import com.woniuxy.microretailserver.service.ISummaryCount;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.text.ParseException;
import java.util.Date;
import java.util.List;

/**
 * @author chenhu
 * 财务收银汇总
 */
@RestController
@RequestMapping("/sft")
public class SumFinTranController {

    @Resource
    private ISummaryCount summaryCountServiceImpl;

    /**
     * 展示或模糊查询财务收银汇总信息
     * @param
     * @return
     */
    @RequestMapping(value = "/findAll",produces = MediaType.APPLICATION_JSON_VALUE)
    public List<SummaryCountDateBean> findAll() {
        List<SummaryCountDateBean> all = summaryCountServiceImpl.findAll();
        all.forEach(e->{
            System.out.println(e);
        });
        return all;
    }

    /**
     * 按时间查询支付表中的金额汇总
     * @param paymentTime
     * @return
     */
    @GetMapping(value = "/findTime",produces = MediaType.APPLICATION_JSON_VALUE)
    public List<SummaryCountDateBean> findSummaryByTimer(String paymentTime){
        List<SummaryCountDateBean> summaryByTimer = summaryCountServiceImpl.findSummaryByTimer(paymentTime);
        summaryByTimer.forEach(e->{
            System.out.println(e);
        });
        return summaryByTimer;
    }
}
